package dwz.cms.article.util.ftp;

import java.io.File;
import java.io.IOException;
import java.util.Vector;


/** 
* Created by Eclipse
* @author : Yating
* @version:2017年4月18日 上午9:33:36 
* 类说明 
*/
public class DeleteThread extends Thread{
	private Vector<File> files;
	private String host;
	private int port;
	private String userName;
	private String password;
	private String initPath;
	private FtpError ftperror;
	
	public DeleteThread() {
		super();
	}

	public DeleteThread(Vector<File> files, String host, int port,
			String userName, String password, String initPath) {
		super();
		this.files = files;
		this.host = host;
		this.port = port;
		this.userName = userName;
		this.password = password;
		this.initPath = initPath;
	}

	public FtpError getFtperror() {
		return ftperror;
	}

	public void setFtperror(FtpError ftperror) {
		this.ftperror = ftperror;
	}

	public Vector<File> getFiles() {
		return files;
	}

	public void setFiles(Vector<File> files) {
		this.files = files;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getInitPath() {
		return initPath;
	}

	public void setInitPath(String initPath) {
		this.initPath = initPath;
	}

	@Override
	public void run() {
		FTPUtils ftp=new FTPUtils();
		ftp.setInitPath(initPath);
		String mess="";
		if(ftperror!=null){
		try {
			ftp.getConnection(host, port, userName, password);
			mess=ftp.deleteFiles(files);
			ftp.closeConnect();
			ftperror.getHashtable().put(host, mess);
		} catch (IOException e) {
			ftperror.getHashtable().put(host, mess);
			e.printStackTrace();
		}
		}
	}
}
 